package com.oa.android.adapter;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

import com.oa.android.R;
import com.oa.android.entry.Next;

import java.util.List;

/**
 * 节点 on 2016/6/15.
 */
public class NextAdapter extends BaseAdapter {

    private Context context;
    private List<Next> gaoList;

    public NextAdapter(Context context, List<Next> list) {
        this.context = context;
        this.gaoList = list;
    }

    @Override
    public int getCount() {
        return gaoList.size();
    }


    @Override
    public Object getItem(int position) {
        return gaoList.get(position);
    }


    @Override
    public long getItemId(int position) {
        return position;
    }


    @Override
    public View getView(int position, View convertView, ViewGroup parent) {

        ViewHodler viewHodler;
        if (convertView==null){
            convertView= LayoutInflater.from(context).inflate(R.layout.item_text,null);
            viewHodler=new ViewHodler();
            viewHodler.textView=(TextView)convertView.findViewById(R.id.name);
            convertView.setTag(viewHodler);
        }else {
            viewHodler= (ViewHodler) convertView.getTag();
        }
        viewHodler.textView.setText(gaoList.get(position).getJIEDIANNAME()+"");
        return convertView;
    }

    class ViewHodler{
        TextView textView;
    }
}
